<?php
require_once $_site->get_viewpath("boss/common/authcheck");
require_once $_site->get_viewpath("mobile/common/header");

$boss_objet=new boss();
$cond['uid']=$boss_id;
//状态  0-全部  1-工作中  2-未绑定 3-待销费
$cond['type']=request('type',false,true,false,0);
$page=request('page',false,true,false,1);
$cols='*';
$list=$boss_objet->_search_car($cond,$cols,$page);
$cur_class[$cond['type']]=" class='cur'";
?>	
</head>

	<body>
		
		<div class="headertwo clearfloat" id="header">	
			<a href="javascript:history.go(-1)" class="fl box-s"><i class="iconfont icon-arrow-l fl"></i></a>
			<p class="fl">我的设备</p>
			<a href="/boss/center" class="fr"><i class="iconfont icon-gerenzhongxin fl"></i></a>
		</div>
		
		<div class="clearfloat" id="main">
		   <div class="rent">
			<div class="top clearfloat">
				<ul>
					<li<?php echo $cur_class[0];?>>
						<a href="?type=0">全部设备</a>
					</li>
					<li<?php echo $cur_class[1];?>>
						<a href="?type=1">已绑定</a>
					</li>
					<li<?php echo $cur_class[2];?>>
						<a href="?type=2">未绑定</a>
					</li>
					<li<?php echo $cur_class[3];?>>
						<a href="?type=3">待续费</a>
					</li>
				</ul>
			</div>
			</div>

			<a href="/boss/bind" class="pay-btn clearfloat">添加设备</a>	
		
			<div class="schedule clearfloat">
				<div class="notice">

					<div class="tab-bd clearfloat">
						<div class="tab-pal">
						
					 	    <?php 		
					 	       $now_time=time();	 	       
					 	       if($list['rows']){
		                          foreach ($list['rows'] as $vo){
                                     $stateinfo=car_state($vo);
					 	    ?>							
							<div class="content clearfloat box-s">
								<div class="topsche-top box-s clearfloat">
									<p class="fl add">
										<i class="iconfont icon-map"></i>
										<b><?php echo $vo['id']?> #</b>
									</p>
									<p class="fl time">
										<i class="iconfont icon-time"></i>
										<?php echo $vo['endtime']>0?($vo['endtime']>$now_time?date('Y-m-d H:i:s',$vo['endtime']):"<font color='red'>".date('Y-m-d H:i:s',$vo['endtime'])."</font>"):'';?>
									</p>
									<p class="tit<?php echo 1==$stateinfo['state']?' titwo ':' ';?>fr">
										<?php echo $stateinfo['msg'];?>
									</p>
								</div>
					    		<div class="list clearfloat fl box-s">	
					    		        <!-- 				    			
						    			<div class="tu clearfloat">
						    				<span></span>
						    				<img src="/static/mobile/img/list-tu.jpg"/>
						    			</div>
						    			 -->
						    			<div class="clearfloat">
						    				<div class="tit clearfloat">
						    					<p class="fl"><?php echo $vo['car']?></p>
						    					<span class="fr"><?php echo $vo['carno']?></span>
						    				</div>
						    				<?php if($vo['linkman']){ ?>
						    				<p class="recom-jianjie"><?php echo $vo['linkman']?'联系人：'.$vo['linkman']:'';?></p>
						    				<?php } if($vo['phone']){ ?>
						    				<p class="recom-jianjie"><?php echo $vo['phone']?'电话：'.$vo['phone']:'';?></p>
						    				<?php } if($vo['code']){ ?>
						    				<p class="recom-jianjie"><?php echo $vo['code']?'设备号：'.$vo['code']:'';?></p>
						    				<?php } ?>	
						    			</div>					    			
					    		</div>	
                                <div class="topsche-top entrust box-s clearfloat">                                                                     
						              <a href="/boss/bind?id=<?php echo $vo['id'];?>" class="tit fr entrust-btn">修改</a>
						              <a href="/boss/profit?id=<?php echo $vo['id'];?>" class="tit fr entrust-btn modaltrigger">充值</a>
						              <?php 
						                if($stateinfo['state']==1){
						              ?>
						              <a href="/boss/recordall?did=<?php echo $vo['codeid'];?>" class="tit fr entrust-btn">查看记录</a>
						              <a href="/boss/report_car?id=<?php echo $vo['id'];?>" class="tit fr entrust-btn">统计报表</a>
						              <?php
                                        }
						              ?>
					            </div>								
					    	</div>
					    	
		    		<?php
                       }}else{
		    		?>
		    		
						<div class="empty-list clearfloat" id="main">
							<i class="iconfont icon-meineirong"></i>
							<p><?php echo $cond['date']?'[ '.$cond['date'].' ]':'';?>没有找到相应记录！</p>
						</div>		    		
 
                     <?php } ?>							    	

					    	
						</div>
						
						
			<?php 
			   if($list['page_count']>1){
			?>	
			<br/>
			<div class="mui-content-padded">
				<ul class="mui-pager">
					<li class="mui-previous">	
					    <?php 
					       if($page<=1){
					    ?>				
						<a href="javascript:;">上一页</a>
						<?php
                           }else{
						?>
						<a href="?<?php echo $querystr;?>&page=<?php echo $page-1;?>">上一页</a>
						<?php } ?>
					</li>
					<li class="mui-disabled">
						<span> <?php echo $page.' / '.$list['page_count'].'  ('.$list['row_count'].')'; ?> </span>
					</li>					
					<li class="mui-next">
					    <?php 
					       if($page>=$list['page_count']){
					    ?>				
						<a href="javascript:;">下一页</a>
						<?php
                           }else{
						?>
						<a href="?<?php echo $querystr;?>&page=<?php echo $page+1;?>">下一页</a>
						<?php } ?>
					</li>
				</ul>
			</div>	
			<?php } ?>							
						
						
					</div>
				</div>
			</div>
		</div>
				
		
	</body>


</html>